/*
 * TestWin.cpp
 *
 *  Created on: Dec 26, 2011
 *      Author: Nico
 */

#include "TestWin.h"
#include <vector>
#include <string>
#include <sstream>

TestWin::TestWin():Window(472, 609, "TestWin") {
	this->add(txtBox);
	txtBox.setXCoord(32);
	txtBox.setYCoord(77);
	txtBox.setWidth(409);
	txtBox.setHeight(32);
	txtBox.setText("Federico");

	// Modo 1
	this->txtDnsServidor = (TextBox*) manage(new TextBox(32, 448, 243, 32, "200.10.20.30"));

	// Modo 2
//	this->txtDnsServidor = new TextBox(32, 448, 243, 32);
//	this->txtDnsServidor->setManaged();

	this->add(*this->txtDnsServidor);
	this->add(*manage(new TextBox(32, 510, 243, 20, "test")));
	this->add(*manage(new TextBox(327, 448, 115, 32)));

	std::vector<std::string> lista;
	int i;
	for (i = 0; i < 10; ++i)
	{
		std::stringstream ss;
		ss << "Elemento" << i;
		lista.push_back(ss.str());
	}
	this->add(*manage(new ListBox(38, 128, 407, 289, lista)));

	this->showAllChildren();
//	this->show(); // equivalente por ser Container
}

TestWin::~TestWin() {
	// TODO Auto-generated destructor stub
}

void TestWin::handleEvent(SDL_Event* event)
{

}

void TestWin::onLoop()
{

}
